package com.yihen.mappers;

import com.yihen.dto.RegistrationDto;
import com.yihen.dto.Result;
import com.yihen.pojo.Registration;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RegistrationMapper {

    // 添加挂号单
    int insert(@Param("reg") Registration registration);

    // 查询所有挂号单dto
    @Select("SELECT t.* FROM view_registration t")
    List<RegistrationDto> queryAllRegistrationDto();

    // 根据患者id查询挂号信息
    @Select("SELECT t.* FROM view_registration t where patient_id=#{id}")
    List<RegistrationDto> queryRegistrationDtoByPatientId(@Param("id") long id);

    // 根据医生id查询挂号信息
    @Select("SELECT t.* FROM view_registration t where doctor_id=#{id}")
    List<RegistrationDto> queryRegistrationDtoByDoctorId(@Param("id") long id);

    // 根据id查询挂号信息
    @Select("SELECT t.* FROM view_registration t where id=#{id}")
   RegistrationDto queryRegistrationDtoById(@Param("id") long id);

    // 根据条件查询
    List<RegistrationDto> queryRegistrationDtoByCondition(@Param("dto") RegistrationDto dto);

}
